<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>课表管理</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" href="../../layui/css/layui.css" media="all" />
	<link rel="stylesheet" href="../../css/public.css" media="all" />
	<script src="../../layui/layui.all.js"></script>
	<script src="../../layui/lay/modules/laytpl.js"></script>
	<style>
		.layui-table-cell {
			height:auto;
			text-align: center;
			/*overflow:visible;*/
			/*text-overflow:inherit;*/
			/*white-space:normal;*/
		}
		/* nav */
		.nav{width: 150px;height: 100%;background: #f5f5f5;transition: all .3s;}
		.nav a{font-size: 16px;display: block;overflow: hidden;padding-left: 10px;line-height: 40px;max-height: 40px;color: #696969;transition: all .3s;}
		.nav a span{margin-left: 30px;}
		.nav-item{font-size: 20px;position: relative;}
		.nav-item.nav-show{border-bottom: none;}
		.nav-item ul{display: none;background: rgba(0,0,0,.1);}
		.nav-item.nav-show ul{display: block;}
		.nav-item>a:before{content: "";position: absolute;left: 0px;width: 2px;height: 46px;background: #34A0CE;opacity:0;transition: all .3s;}
		.nav .nav-icon{font-size: 20px;position: absolute;margin-left:-1px;}

		/*---------------------*/
		.nav-show .nav-more{transform:rotate(90deg);}
		.nav-show,.nav-item>a:hover{color: #4169e1;background:rgba(0,0,0,.1);}
		.nav-show>a:before,.nav-item>a:hover:before{opacity:1;}
		/*.nav-item li:hover a{color: #4169e1;background: rgba(0, 0, 0,.1);}*/
		.nav-item2 li:hover a{color: #4169e1;background: rgba(0, 0, 0,.1);}
	</style>
	<script>
        layui.use(['laytpl','form'],function(layptl,form){
            var data = null;
            var data2 = null;
            window.onload = function () {
                var $ = layui.jquery;
                $.post({
                    url:"/school/queryAllSchoolBuildRoom",
                    async:false,
                    success: function (res) {
                        // console.log(res);
                        data = res;
                    }
                });

                // var laytpl = layui.laytpl;
                //建立视图。用于呈现渲染结果。
                var gettpl = document.getElementById('testTpl').innerHTML;
                layptl(gettpl).render(data, function (html) {
                    // console.log(html)
                    //得到的模板渲染到html
                    document.getElementById('aat').innerHTML = html;
                });

/*                var data2 = [
                    "2019-2020-2",
                    "2019-2020-1"
                ];*/

                $.post({
                    url:"/sys/querySemesterIdDistinct",
                    async:false,
                    success: function (res) {
                        // console.log(res);
                        data2 = res;
                    }
                });

                var gettp2 = document.getElementById('testTp2').innerHTML;
                layptl(gettp2).render(data2, function (html) {
                    // console.log(html)
                    //得到的模板渲染到html
                    document.getElementById('666').innerHTML = html;
                });

                // var form = layui.form; //只有执行了这一步，部分表单元素才会自动修饰成功
                form.render();
                form.render('select' ,'test'); //刷新select选择框渲染
            }
		});

	</script>
</head>
<body class="childrenBody">

<script id="testTpl" type="text/html">

		{{# for(var i = 0; i < d.data.length; i++){ }}
		<li class='nav-item'>
			<a href='javascript:;'>
				<span>{{ d.data[i].p }}</span>
				<i class='layui-icon nav-icon'>&#xe625;</i>
			</a>
			{{# for(var j = 0; j < d.data[i].build.length; j++){ }}
			<ul class="aat2">
				<li class='nav-item2'>
					<a name='t1' schoolId='{{ d.data[i].pid }}' tBuildID='{{ d.data[i].build[j].cid }}' href='javascript:;'>&nbsp;&nbsp;
						<span>{{ d.data[i].build[j].c }}</span>
						<i class='layui-icon nav-icon'>&#xe625;</i>
					</a>
					<ul>
						{{# for(var k = 0; k < d.data[i].build[j].room.length; k++){ }}
						<li>
							<a class="t2" name='t2' schoolId='{{ d.data[i].pid }}' tBuildID='{{ d.data[i].build[j].cid }}' classroomID='{{ d.data[i].build[j].room[k].rid }}' href='javascript:;'>&nbsp;&nbsp;
								<span>{{ d.data[i].build[j].room[k].r }}</span>
							</a>
						</li>
						{{# } }}
					</ul>
				</li>
			</ul>
			{{# } }}
		</li>
		{{# } }}
</script>

<script id="testTp2" type="text/html">
	<option value="xxx">请选择学期</option>
	{{# for(var i = 0; i < d.length; i++){ }}
		<option value='{{ d[i] }}'>{{ d[i] }}</option>
	{{# } }}
</script>

	<div class="layui-col-md2" style="width:150px"><!--学校导航-->
		<div style="background-color:#eeeeee;line-height: 40px;text-align: center; height: 40px;font-size: small;">学校导航</div>
		<!--学校教学楼导航栏开始-->
		<div style='border:0px;padding:3px; PADDING:0px; width:200px; height:685px; LINE-HEIGHT: 20px; overflow-y: auto; overflow-x: hidden;'>
			<div class="nav">
				<ul id="aat" lay-filter="demo"></ul>
			</div>
		</div>
		<!--学校教学楼导航栏结束-->
	</div>

	<div class="layui-col-md7">
		<div class="layui-form" lay-filter="myDiv" style="width:120px;text-align:center;float: left">
			<!--<label class="layui-form-label">请选择学期</label>-->
			<select name="" id="666" lay-filter="mySelect">
				<option value="xxx">请选择学期</option>
				<!--<div id="666">王先生</div>-->
			</select>
		</div>
		<fieldset class="layui-elem-field site-demo-button" style="float: right;">
			<div>
				<a href="/page/schedule/A000.xls" class="layui-btn">获得导入模板</a>
				<button type="button" class="layui-btn" id="test1">
					<i class="layui-icon">&#xe67c;</i>我要导入
				</button>
				<a href="/schedule/exportSch" class="layui-btn">我要导出</a>
			</div>
		</fieldset>

		<table id="demo" lay-filter="test" class="layui-table-cell"></table>
	</div>
	<script type="text/javascript" src="../../layui/layui.js"></script>
	<script type="text/javascript" src="schedule.js"></script> <!--左侧导航栏-->
</body>
</html>
